﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Scoreboard.Interfaces;
using System.ServiceModel.DomainServices.Client;
using Scoreboard.Model;
using Scoreboard.Model.Services;

namespace Scoreboard.Repository
{
	public class Repository : IRepository
	{
		private ScoreboardDomainContext _context;

		public Repository(ScoreboardDomainContext context)
		{
			_context = context;
		}

		public User CurrentUser
		{
			get
			{
				return Context.CurrentUser;
			}
		}

		public ScoreboardDomainContext Context
		{
			get
			{
				return _context;
			}
		}

		public void SubmitChanges()
		{
			_context.SubmitChanges();
		}

		public void SubmitChanges(Action<SubmitOperation> callback)
		{
			_context.SubmitChanges(callback, null);
		}

		public void DiscardChanges()
		{
			_context.RejectChanges();
		}
	}
}
